import Login from '@/views/login.vue';
import Layout from '@/layout';
import system from './modules/system'; // 系统管理
import ProwerInquire from './modules/ProwerInquire'; // 潜客查询
import AccountManager from './modules/AccountManager'; // 客户经理管户管理
import task from './modules/task';
import customManager from './modules/customManager';
import prowler from './modules/prowler'; // 潜客管理
import customerdivision from './modules/customerdivision'; // 客户分户管理
import marketingManager from './modules/marketingManager'; // 客户分户管理
import myClient from './modules/myClient' //我的客户
import agentMatters from './modules/agentMatters';
// import customerAllocationManager from './modules/customerAllocationManager';
import customChallengeManager from './modules/customChallengeManager';
import customerGroup from './modules/customerGroup';

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/utils/util.import');

// 导出需要显示菜单的
export const frameInRoutes = [
  system,
  ProwerInquire,
  AccountManager,
  task,
  customManager,
  prowler,
  customerdivision,
  marketingManager,
  // customerAllocationManager,
  myClient,
  agentMatters,
  customChallengeManager,
  customerGroup
];
// console.log(...frameInRoutes,[system,task],'[system]')

/**
 * 在主框架内显示
 */
const frameIn = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/home',
        name: 'home',
        component: _import('home.vue'),
        meta: {
          title: '首页',
        },
      },
    ],
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/publicHome',
        name: 'publicHome',
        component: _import('publicHome.vue'),
        meta: {
          title: '对公首页',
        },
      },
    ],
  },
  ...frameInRoutes,
];
/**
 * 在主框架之外显示
 */
const frameOut = [
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {
      skipAuth: true,
      title: '登录',
    },
  },
];

/**
 * 错误页面
 */

const errorPage = [
  {
    path: '*',
    name: '404',
    component: _import('error/404'),
  },
];

// 重新组织后导出
export default [...frameIn, ...frameOut, ...errorPage];
